(function() {

  'use strict';
  /**
   * @ngdoc function
   * @name sasApp.controller:OmdisplaySysbusstatSysbusstatCtrl
   * @description
   * # OmdisplaySysbusstatSysbusstatCtrl
   * Controller of the sasApp
   */
  angular.module('controllers.omdisplay.sysBusStat').controller('contrastiveAnalysisCtrl', contrastiveAnalysisMemu);
  angular.module('controllers.omdisplay.sysBusStat').controller('contrastiveAnalysisCharCtl', contrastiveAnalysisCharCtl);

  function contrastiveAnalysisMemu($scope, contrastiveAnalysis, $timeout, $filter, $mdDialog, CoreService, COREDATA, contrastiveStaticServer, contrastiveLogicServer, getAgency, getChannel, ContrastiveDynamic) {
    $scope.item = {};
    //机构选项查询方法,
    $scope.agencys = getAgency;
    //季度下拉框
    $scope.quarters = COREDATA.QUARTERS;
    //账期下拉查询
    $scope.timeTypes = COREDATA.TIMETYPES;
    //省份查询
    $scope.provinces = COREDATA.PROVINCES;
    $scope.businessLines = COREDATA.BUSINESSLINE;
    //对比方式下拉选择数据
    $scope.analysiss = contrastiveStaticServer.getAnalysisTypes;
    //统计方式查询
    $scope.showType = ContrastiveDynamic.showType;
    //账期
    $scope.param = ContrastiveDynamic.param;
    $scope.analysis = ContrastiveDynamic.analysis;
    $scope.item = ContrastiveDynamic.item;
    $scope.timeTitle = {
      start: '时间段1:',
      end: '时间段2:'
    };
    /**
     * [showType 显示方式,默认为时间]
     * @type {string}
     */
    $scope.flex = ContrastiveDynamic.flex;
    /**
     * [lengthSwitch 表和图显示切换默认为表]
     * @type {Boolean}
     */
    contrastiveLogicServer.paramInit();
    $scope.lengthSwitch = ContrastiveDynamic.lengthSwitch;
    $scope.contrastive = ContrastiveDynamic.contrastive;
    /**
     * [监控业务线下拉框方法]
     */
    $scope.show = {
      agency: false,
      channel: false,
      transaction: false
    };
    $scope.getBL = function(value){
      var bl = {
        businessLine:[]
      };
      $timeout(function(){
        if(value){
          value.businessLineCode === '2' ? $scope.show.agency = true :  $scope.show.agency = false;
          bl.businessLine.push(value.businessLineCode);
          contrastiveAnalysis.getChannel(bl,function(res){
            if(res.data.length === 0){
              $scope.show.channel = false;
            }else {
              $scope.channels = res.data;
              $scope.show.channel = true;
            }
          });
          contrastiveAnalysis.getTransacTion(bl,function(res){
            $scope.transactions = res.data;
            $scope.show.transaction = true;
          });
        }else {
          $scope.show.agency = false;
          $scope.show.channel = false;
          $scope.show.transaction = false;
          $scope.contrastive.businessLine = '';
        }
      });
      $scope.contrastive.transaction = [];
      $scope.contrastive.agency = [];
      $scope.contrastive.channel = [];
    };
    $scope.$watch('param.timeType', function(newValue,oldValue) {
      $scope.showTypes = contrastiveStaticServer.getShowTypes(newValue);
      $scope.showType = '2';
      contrastiveLogicServer.timedefault(newValue, $scope.analysis);
    });
    /**
     *
     *  根据开始时间判断时间 如果开始时间起始与开始时间结束不等于undefined,也就是输入的数字是合法的
     *  年:判断开始时间起始和开始时间结束之间的距离数字
     */
    $scope.$watch('analysis', function(newValue) {
      contrastiveLogicServer.timeAnalysis($scope.param.timeType, newValue);
    });
    $scope.$watch('showType',function(newValue){
      newValue === '0' ? $scope.showAnalysis = false : $scope.showAnalysis = true;
    });
    /**
     * [dropDrowSw Div伸缩回调函数]
     * @return {[Number]} [首先判断表单函数是否合法，合法就调用广播queryModel穿入属性名字,第一属性名为undefined
     *                     根据广播（queryModel）找到查询控制器,因为属性名为undefined,所有查询的是业务量.如果有数据放回利用广播
     *                     （queryDivSw）传入数字0到表单层,这个时候给表单flex伸缩属性设置为true,永久的存在下拉属性。
     *                      queryDivSw广播--控制是否有数据判以及div伸缩
     *                      attributeName--判断用户处于哪个页面,（业务量，交易金额,充值金额）便于用户点击查询按钮时候还处于单前页面
     *                      queryModel--向下传播,查询，传入查询属性名
     *                      ]
     */
    $scope.dropDrowSw = function() {
      if ($scope.shoumun) {

        $scope.$on('queryDivSw', function(a, b) {
          $scope.shoumun = b;
          $scope.flex = true;
        });
        $scope.$on('attributeName', function(a, b) {
          $scope.attributeName = b;
        });
        $scope.$broadcast('queryModel', $scope.attributeName);
      } else {
        $scope.shoumun = 1;
      }
    };
  }
  //防止注入依赖
  contrastiveAnalysisMemu.$inject = ['$scope', 'contrastiveAnalysis', '$timeout', '$filter', '$mdDialog', 'CoreService', 'COREDATA', 'contrastiveStaticServer', 'contrastiveLogicServer', 'getAgency', 'getChannel', 'ContrastiveDynamic'];

  function contrastiveAnalysisCharCtl($scope, contrastiveAnalysis, $timeout, $filter, $mdDialog, CoreService, COREDATA, contrastiveLogicServer,PublicFn) {
    //加载echarts图表信息
    var demo = echarts.init(document.getElementById('main'));
    //设置导出路径
    $scope.excelExport = COREDATA.FORMPREFIX + 'Omdisplay/sysBusinessStatistics/compareExcelExport';
    //根据广播传入数据，选择查询方法
    $scope.$on('queryModel', function(a, d) {
      switch (d) {
        case '业务量':
        case undefined:
          $scope.portfolioTimeQuery();
          break;
        case '订单金额':
          $scope.orderAmountQuery();
          break;
        case '充值金额':
          $scope.payQuery();
          break;
      }
    });
    // 发生给后台打时间填充时间格式化,发送后台,做数据转换，发送数组格式的数据
    // 时间：调用server方法传入格式化样式，发送后台
    function timeFormart(data) {
      $scope.param.businessLine = [];
      if (!$scope.contrastive.businessLine.businessLineCode) {
        $scope.param.businessLine = contrastiveLogicServer.parseObj($scope.businessLines, 'businessLineCode');
        $scope.param.businessName = '全部';
      } else {
        $scope.param.businessLine.push($scope.contrastive.businessLine.businessLineCode);
        $scope.param.businessName = $scope.contrastive.businessLine.businessLineName;
      }
      $scope.param.provinceCodes = contrastiveLogicServer.parseObj($scope.contrastive.province, 'provinceCode');
      $scope.param.organization = contrastiveLogicServer.parseObj($scope.contrastive.agency, 'organizationCode');
      $scope.param.transactionTypeCodes = contrastiveLogicServer.parseObj($scope.contrastive.transaction, 'tradeTypeCode');
      $scope.param.channel = contrastiveLogicServer.parseObj($scope.contrastive.channel, 'channelCode');
      if ($scope.param.timeType === '4') {
        $scope.param.startTime = $filter('date')(new Date(Date.parse(contrastiveLogicServer.timeSplitRequest($scope.item.startTime).timeYear)), 'yyyy-01-01');
        $scope.param.startQuarter = contrastiveLogicServer.timeSplitRequest($scope.item.startTime).quarter;
        $scope.param.startTimes = $filter('date')(new Date(Date.parse(contrastiveLogicServer.timeSplitRequest($scope.item.startTimes).timeYear)), 'yyyy-01-01');
        $scope.param.startQuarters = contrastiveLogicServer.timeSplitRequest($scope.item.startTimes).quarter;
        $scope.param.endTime = $filter('date')(new Date(Date.parse(contrastiveLogicServer.timeSplitRequest($scope.item.endTime).timeYear)), 'yyyy-01-01');
        $scope.param.endTimes = $filter('date')(new Date(Date.parse(contrastiveLogicServer.timeSplitRequest($scope.item.endTimes).timeYear)), 'yyyy-01-01');
        $scope.param.endQuarter = contrastiveLogicServer.timeSplitRequest($scope.item.endTime).quarter;
        $scope.param.endQuarters = contrastiveLogicServer.timeSplitRequest($scope.item.endTimes).quarter;
      } else {
        $scope.param.startTime = contrastiveLogicServer.timeFormart($scope.param.timeType, data.startTime);
        $scope.param.startTimes = contrastiveLogicServer.timeFormart($scope.param.timeType, data.startTimes);
        $scope.param.endTime = contrastiveLogicServer.timeFormart($scope.param.timeType, data.endTime);
        $scope.param.endTimes = contrastiveLogicServer.timeFormart($scope.param.timeType, data.endTimes);
      }
    }

    /**
     * 查询业务量打请求,分类型查询,根据用户选择的统计方式，来发送不同的uil,用于展示图表
     * 绑定的统计方式为0是时间查询,为2是省份查询,根据showtype判断查询的方法
     * showType --> 0:时间  1:省份  2:汇总
     */
    var title;
    $scope.portfolioTimeQuery = function(queryName) {
      $scope.$emit('attributeName', queryName);
      $scope._loading.show = true;
      timeFormart($scope.item);
      var time = $scope.param.startTime;
      if(time === $scope.param.startTimes && time ===  $scope.param.endTime && time ===  $scope.param.endTimes){
        $scope._loading.show = false;
        CoreService.dialog('请对比不同的时间段');
        return;
      }
      title = '1';
      $scope.param.flag = undefined;
      if($scope.showType === '1'){
        contrastiveAnalysis.portfolioprovinceQuery($scope.param, graphProvinceRequest);
      }else if($scope.showType === '0'){
        contrastiveAnalysis.portfolioTimeQuery($scope.param, graphTimeRequest);
      }else {
        contrastiveAnalysis.portfolioCollectQuery($scope.param, graphCollectRequest);
      }
      $scope.titleName = '业务量';
    };
    //充值金额时间查询，利用showType判断查询的发方法,利用回调函数处理
    $scope.payQuery = function(queryName) {
      $scope._loading.show = true;
      $scope.$emit('attributeName', queryName);
      timeFormart($scope.item);
      var time = $scope.param.startTime;
      if(time === $scope.param.startTimes && time ===  $scope.param.endTime && time ===  $scope.param.endTimes){
        $scope._loading.show = false;
        CoreService.dialog('请对比不同的时间段');
        return;
      }
      title = '3';
      $scope.param.flag = undefined;
      $scope.param.showType = $scope.showType;
      $scope.showType === '1' ? contrastiveAnalysis.payProviceQuery($scope.param, graphProvinceRequest) :
        $scope.showType === '0' ? contrastiveAnalysis.payTimeQuery($scope.param, graphTimeRequest) :
        contrastiveAnalysis.payCollectQuery($scope.param, graphCollectRequest);
      $scope.titleName = '充值金额';
    };
    // 订单金额查询，利用showType判断查询的方法，利用回调函数处理
    $scope.orderAmountQuery = function(queryName) {
      $scope._loading.show = true;
      $scope.$emit('attributeName', queryName);
      timeFormart($scope.item);
      var time = $scope.param.startTime;
      if(time === $scope.param.startTimes && time ===  $scope.param.endTime && time ===  $scope.param.endTimes){
        $scope._loading.show = false;
        CoreService.dialog('请对比不同的时间段');
        return;
      }
      title = '2';
      $scope.param.flag = undefined;
      $scope.param.showType = $scope.showType;
      $scope.showType === '1' ? contrastiveAnalysis.orderAmountProviceQuery($scope.param, graphProvinceRequest) :
        $scope.showType === '0' ? contrastiveAnalysis.orderAmountTimeQuery($scope.param, graphTimeRequest) :
        contrastiveAnalysis.orderAmountCollectQuery($scope.param, graphCollectRequest);
      $scope.titleName = '订单金额';
    };
    //定义查询列表和图表的省份回调函数 div 查询出来数据则把查询DIV
    function graphProvinceRequest(result) {
      if (is.equal(result.state, '10000')) {
        if (result.data.sumportfolio + result.data.sumportfolios === 0) {
          $scope.flex = false;
          $scope.lengthSwitch = '';
          $scope._loading.show = false;
          CoreService.dialog(result.state);
        } else {
          $scope.$emit('queryDivSw', 0);
          $scope._loading.show = false;
          $scope.items = result.data.result;
          $scope.sumportfolio = result.data.sumportfolio;
          $scope.sumportfolios = result.data.sumportfolios;
          $scope.collectAnalysis = result.data.collectAnalysis;
          $scope.showTable = false;
          demo.clear();
          var rotateDate = result.data.result.length > 16 ? 55 : 0;
          var xAxisData = contrastiveLogicServer.xAxis(result.data.result, 'provinceName');
          listingText($scope.param);
          var yName = $scope.titleName !== '业务量' ? '单位(元)' : '单位(笔)';
          $scope.seriesstateName = getTitle($scope.param);
          // $scope.seriesstateName = $scope.showRow.startTime + contrastiveLogicServer.quarter($scope.param.startQuarter, $scope.param.timeType) + '_' + $scope.showRow.startTimes + contrastiveLogicServer.quarter($scope.param.startQuarters, $scope.param.timeType);
          // $scope.seriesendName = $scope.showRow.endTime + contrastiveLogicServer.quarter($scope.param.endQuarter, $scope.param.timeType) + '_' + $scope.showRow.endTimes + contrastiveLogicServer.quarter($scope.param.endQuarters, $scope.param.timeType) + ' ' + $scope.titleName;
          $scope.seriesstateNametitle = $scope.showRow.startTime + contrastiveLogicServer.quarter($scope.param.startQuarter, $scope.param.timeType) + '至' + $scope.showRow.startTimes + contrastiveLogicServer.quarter($scope.param.startQuarters, $scope.param.timeType) + $scope.titleName;
          $scope.seriesendNametitle = $scope.showRow.endTime + contrastiveLogicServer.quarter($scope.param.endQuarter, $scope.param.timeType) + '至' + $scope.showRow.endTimes + contrastiveLogicServer.quarter($scope.param.endQuarters, $scope.param.timeType) + $scope.titleName;
          var option = contrastiveLogicServer.barLegend(contrastiveLogicServer.dataProvinceClassification(result.data.result), $scope.seriesstateNametitle,
            $scope.seriesendNametitle, 'line', xAxisData, yName, rotateDate, $scope.titleName);
          demo.setOption(option);
          $timeout(function() {
            exportList($scope.seriesstateName);
          }, 400);
        }
      } else {
        $scope.flex = false;
        $scope.lengthSwitch = '';
        $scope._loading.show = false;
        CoreService.dialog(result.state);
      }
    }
    //定义查询类表和图表的时间回调函数
    function graphTimeRequest(result) {
      if (is.equal(result.state, '10000')) {
        if (result.data.sumportfolio + result.data.sumportfolios === 0) {
          $scope.flex = false;
          $scope.lengthSwitch = '';
          $scope._loading.show = false;
          CoreService.dialog(result.state);
        } else {
          $scope.$emit('queryDivSw', 0);
          $scope._loading.show = false;
          $scope.items = result.data.result;
          $scope.sumportfolio = result.data.sumportfolio;
          $scope.sumportfolios = result.data.sumportfolios;
          $scope.collectAnalysis = result.data.collectAnalysis;
          $scope.showTable = true;
          demo.clear();
          var rotateDate = $scope.param.timeType === '5' || $scope.param.timeType === '4' ? 0 : 30;
          $scope.showText = contrastiveLogicServer.showText($scope.param.timeType);
          listingText($scope.param);
          var yName = $scope.titleName !== '业务量' ? '单位(元)' : '单位(笔)';
          $scope.seriesstateName = getTitle($scope.param);
          // $scope.seriesstateName = $scope.showRow.startTime + contrastiveLogicServer.quarter($scope.param.startQuarter, $scope.param.timeType) + '_' + $scope.showRow.startTimes + contrastiveLogicServer.quarter($scope.param.startQuarters, $scope.param.timeType);
          // $scope.seriesendName = $scope.showRow.endTime + contrastiveLogicServer.quarter($scope.param.endQuarter, $scope.param.timeType) + '_' + $scope.showRow.endTimes + contrastiveLogicServer.quarter($scope.param.endQuarters, $scope.param.timeType) + ' ' + $scope.titleName;
          $scope.seriesstateNametitle = $scope.showRow.startTime + contrastiveLogicServer.quarter($scope.param.startQuarter, $scope.param.timeType) + '至' + $scope.showRow.startTimes + contrastiveLogicServer.quarter($scope.param.startQuarters, $scope.param.timeType) + $scope.titleName;
          $scope.seriesendNametitle = $scope.showRow.endTime + contrastiveLogicServer.quarter($scope.param.endQuarter, $scope.param.timeType) + '至' + $scope.showRow.endTimes + contrastiveLogicServer.quarter($scope.param.endQuarters, $scope.param.timeType) + $scope.titleName;

          var option = contrastiveLogicServer.barLegend(dataTimeClassification(result.data.result), $scope.seriesstateNametitle, $scope.seriesendNametitle, 'line',
            $scope.xAxisData, yName, rotateDate, $scope.titleName);
          demo.setOption(option);
          $timeout(function() {
            exportList($scope.seriesstateName);
          }, 400);
        }
      } else {
        $scope.flex = false;
        $scope.lengthSwitch = '';
        $scope._loading.show = false;
        CoreService.dialog(result.state);
      }
    }
    /**
     *  汇总时间查询
     */
    function graphCollectRequest(result) {
      if (is.equal(result.state, '10000')) {
        if (result.data.sumportfolio + result.data.sumportfolios === 0) {
          $scope.flex = false;
          $scope.lengthSwitch = '';
          $scope._loading.show = false;
          CoreService.dialog(result.state);
        } else {
          $scope.$emit('queryDivSw', 0);
          $scope._loading.show = false;
          $scope.items = result.data.result;
          $scope.sumportfolio = result.data.sumportfolio;
          $scope.sumportfolios = result.data.sumportfolios;
          $scope.collectAnalysis = result.data.collectAnalysis;
          $scope.showTable = true;
          demo.clear();
          var rotateDate = 55;
          $scope.showText = '业务线';
          listingText($scope.param);
          var xAxisData = contrastiveLogicServer.xAxis(result.data.result, 'fecha');
          var yName = $scope.titleName !== '业务量' ? '单位(元)' : '单位(笔)';
          $scope.seriesstateName = getTitle($scope.param);
          // $scope.seriesstateName = $scope.showRow.startTime + contrastiveLogicServer.quarter($scope.param.startQuarter, $scope.param.timeType) + '_' + $scope.showRow.startTimes + contrastiveLogicServer.quarter($scope.param.startQuarters, $scope.param.timeType);
          // $scope.seriesendName = $scope.showRow.endTime + contrastiveLogicServer.quarter($scope.param.endQuarter, $scope.param.timeType) + '_' + $scope.showRow.endTimes + contrastiveLogicServer.quarter($scope.param.endQuarters, $scope.param.timeType) + ' ' + $scope.titleName;
          $scope.seriesstateNametitle = $scope.showRow.startTime + contrastiveLogicServer.quarter($scope.param.startQuarter, $scope.param.timeType) + '至' + $scope.showRow.startTimes + contrastiveLogicServer.quarter($scope.param.startQuarters, $scope.param.timeType) + $scope.titleName;
          $scope.seriesendNametitle = $scope.showRow.endTime + contrastiveLogicServer.quarter($scope.param.endQuarter, $scope.param.timeType) + '至' + $scope.showRow.endTimes + contrastiveLogicServer.quarter($scope.param.endQuarters, $scope.param.timeType) + $scope.titleName;
          var option = contrastiveLogicServer.barLegend(contrastiveLogicServer.dataProvinceClassification(result.data.result), $scope.seriesstateNametitle, $scope.seriesendNametitle,
            'bar', xAxisData, yName, rotateDate, $scope.titleName);
          demo.setOption(option);
          $timeout(function() {
            exportList($scope.seriesstateName);
          }, 400);
        }
      } else {
        $scope.flex = false;
        $scope.lengthSwitch = '';
        $scope._loading.show = false;
        CoreService.dialog(result.state);
      }
    }
    //列表的横轴标题栏显示调用server方法进行格式化
    function listingText(data) {
      $scope.showRow = {};
      $scope.showRow.startTime = contrastiveLogicServer.textFormaty($scope.param.timeType, data.startTime);
      $scope.showRow.startTimes = contrastiveLogicServer.textFormaty($scope.param.timeType, data.startTimes);
      $scope.showRow.endTime = contrastiveLogicServer.textFormaty($scope.param.timeType, data.endTime);
      $scope.showRow.endTimes = contrastiveLogicServer.textFormaty($scope.param.timeType, data.endTimes);
    }

    //导出exportList获取base64
    function exportList(stateTitle) {
      $scope.ExportList = {};
      $scope.param.flag = (title === '1' ? '1' : title === '2' ? '2' : '3');
      angular.copy($scope.param, $scope.ExportList);
      $scope.ExportList.showType = $scope.showType;
      $scope.ExportList.title1 = $scope.seriesstateNametitle;
      $scope.ExportList.title2 = $scope.seriesendNametitle;
      $scope.ExportList.title = stateTitle + '对比分析表';
      $timeout(function() {
        var str = demo.getDataURL('png');
        $scope.ExportList.base64 = str.slice(str.indexOf(',') + 1);
      }, 100);
    }
    //时间请求x轴补0操作
    function dataTimeClassification(data) {
      var param = contrastiveLogicServer.xAxisTime($scope.param.timeType);
      $scope.xAxisDatas = param.xAxisDatas;
      $scope.xAxisData = param.xAxisData;
      $scope.params = {
        portfolio: [],
        portfolios: [],
        contrastar: []
      };
      if($scope.param.timeType === '1' && ($scope.contrastive.businessLine.businessLineCode === '1' || $scope.contrastive.businessLine.businessLineCode === undefined)){
        $scope.xAxisData = [];
        angular.forEach(data, function(key) {
          $scope.xAxisData.push(key.fecha + '时刻');
          $scope.params.portfolio.push(key.portfolio);
          $scope.params.portfolios.push(key.portfolios);
          $scope.params.contrastar.push(key.contrastar);
        });
      } else {
        angular.forEach(data, function(key) {
          $scope.params.portfolio.push(key.portfolio);
          $scope.params.portfolios.push(key.portfolios);
          $scope.params.contrastar.push(key.contrastar);
        });
      }
      return $scope.params;
    }
    function getTitle(params){
      var blName = '';
      params.businessName === '全部' ? blName = '统一支付系统' : blName = params.businessName;
      var start = fmtDateTitle(params,'startTime','startTimes','startQuarter','startQuarter','timeType');
      var end = fmtDateTitle(params,'endTime','endTimes','endQuarter','endQuarters','timeType');
      return start+' 与 '+end + blName;
    }
    /**
     *@fmtDateTitle {object}    格式化时间标题,根据选择不同的时间类型,给予不同的时间标题:
     *如开始时间为:2014-01-01,结束时间为:2015-01-01,则获取的标题为'2014年01月01号 至 2015年01月01号'
     *当开始时间和结束时间相同时,只显示开始时间
     * @send  {object} 里面包含send.startTime,send.endTime
     * @prototypeName  {string}  send对象里面的属性名.用来确定账期的字段名
     * @return {string} 返回的字符串.如:2014年01月01号 至 2015年01月01号
     */
    function fmtDateTitle(send,startTime,endTime,startQuarter,endQuarter,prototypeName){
      var timeTitle = '';
      var timeType = send[prototypeName];
      //2014-01-01
      var startYear = send[startTime].substring(0, 4)+'年';
      var endYear = send[endTime].substring(0, 4)+'年';
      var startMonth = send[startTime].substring(5, 7)+'月';
      var endMonth = send[endTime].substring(5, 7)+'月';
      var startDay = send[startTime].substring(8, 10)+'日';
      var endDay = send[endTime].substring(8, 10)+'日';
      var booleanYear = startYear === endYear;
      var booleanMonth = startMonth === endMonth;
      var booleanDay = startDay === endDay;
      switch(timeType){
        case '5':
          timeTitle  = booleanYear ? startYear : startYear+'至'+ endYear;
          break;
        case '4':
          var startQuarterName = getQuarterName(send[startQuarter]);
          var endQuarterName = getQuarterName(send[endQuarter]);
          if(booleanYear && startQuarterName === endQuarterName){
            timeTitle = startYear+startQuarterName;
          }else {
            timeTitle = startYear + startQuarterName +'至' + endYear + endQuarterName;
          }
          break;
        case '3':
          timeTitle = booleanYear && booleanMonth ? startYear + startMonth : startYear + startMonth + '至' + endYear + endMonth;
          break;
        default:
          if(booleanYear && booleanMonth && booleanDay){
            timeTitle = startYear + startMonth + startDay;
          }else {
            timeTitle =  startYear + startMonth + startDay +'至' + endYear + endMonth + endDay;
          }
          break;
      }
      return timeTitle;
    }
    //根据不同的季度code,显示不同的季度名称，拼接标题季度使用的方法
    function getQuarterName(data){
      var quarterName = '';
      switch (data) {
        case '1':
          quarterName = '第一季度';
          break;
        case '2':
          quarterName = '第二季度';
          break;
        case '3':
          quarterName = '第三季度';
          break;
        case '4':
          quarterName = '第四季度';
          break;
      }
      return quarterName;
    }
  }
  contrastiveAnalysisCharCtl.$inject = ['$scope', 'contrastiveAnalysis', '$timeout', '$filter', '$mdDialog', 'CoreService', 'COREDATA', 'contrastiveLogicServer','PublicFn'];


})();